<include file="public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>

<div class="wrapper">

    <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">

            <div class="panel panel-default">
                <div class="panel-body ">
                    <!--表单数据-->
                    <form method="post" id="handle_shop">

                        <!--通用信息-->
                        <div class="tab-content col-md-10">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>

                                    <tr>
                                        <td class="col-sm-2">订单编号：</td>
                                        <td class="col-sm-8" colspan="5">
                                            <p class="form-control-static">{$orderInfo.orderCourseNo}</p>
                                        </td>
                                    </tr>


                                    <tr>
                                        <td class="col-sm-2">用户昵称：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{$orderInfo.user.nickName}</p>
                                        </td>
                                        <td class="col-sm-2">联系电话：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{$orderInfo.user.userMobile}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">订单状态：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{$orderCourseStatus[$orderInfo.orderStatus]}</p>
                                        </td>
                                        <td class="col-sm-2">下单时间：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{:date('Y-m-d h:i:s', $orderInfo['orderAddTime'])}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">支付时间：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo['orderPayTime'] > 0 ? date('Y-m-d h:i:s', $orderInfo['orderPayTime']) : ""}</p>
                                        </td>
                                        <td class="col-sm-2">支付方式：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo['orderPayName']}</p>
                                        </td>
                                        <td class="col-sm-2">第三方流水号：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo['orderTransactionId']}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">订单总价：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo.orderPrice}</p>
                                        </td>
                                        <td class="col-sm-2">购买数量：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo.orderNum}</p>
                                        </td>
                                        <td class="col-sm-2">实际支付：</td>
                                        <td class="col-sm-2">
                                            <p class="form-control-static">{$orderInfo.orderActualPrice}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">订单备注：</td>
                                        <td class="col-sm-2" colspan="5">
                                            <p class="form-control-static">{$orderInfo.orderNote}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">课程：</td>
                                        <td class="col-sm-2" colspan="5">
                                            <p class="form-control-static">{$orderInfo.orderCourseName}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">店铺：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{$orderInfo.shop.shopName}</p>
                                        </td>
                                        <td class="col-sm-2">教练：</td>
                                        <td class="col-sm-2" colspan="2">
                                            <p class="form-control-static">{$orderInfo.coach.coachName}</p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">评价信息：</td>
                                        <td class="col-sm-2" colspan="5">
                                            <p class="form-control-static">{$orderInfo.evaluation.orderEvaluationAddTime > 0 ? date('Y-m-d H:i:s', $orderInfo.evaluation.orderEvaluationAddTime): ""}</p>
                                            <p class="form-control-static">{$orderInfo.evaluation.orderEvaluationContent}</p>
                                            {$orderEvaluationImages}
                                            <p class="form-control-static">
                                                <if condition="$orderEvaluationImages != ''">
                                                <volist name="orderEvaluationImages" id="orderEvaluationImages">
                                                    <a href="{$orderEvaluationImages}" target="_blank"><img src="{$orderEvaluationImages}" style="width: 100px;height: 80px"/></a>
                                                </volist>
                                                </if>
                                            </p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="col-sm-2">订单操作记录：</td>
                                        <td class="col-sm-2" colspan="5">
                                            <volist name="orderLog" id="orderLog">
                                                <p class="form-control-static">{:date('Y-m-d H:i:s', $orderLog['logAddTime'])}&ensp;&ensp;{$orderLog.logName}&ensp;&ensp;{$orderLog.logContent}</p>
                                            </volist>
                                        </td>
                                    </tr>


                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="6" class="text-right">
                                            <if condition="$orderInfo.orderStatus == '1'">
                                                <input class="btn btn-success" type="button" onclick="orderSubmit({$orderInfo.orderCourseId})" value="完成订单">
                                            </if>
                                            <input class="btn btn-primary" type="button" onclick="shop_submit()" value="关闭">
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function shop_submit(){
        window.parent.location.reload();
    }

    function orderSubmit(orderId){

        layer.confirm('确认完成该订单吗？', function(){
                $.ajax({
                    type: "POST",
                    url: "{:url('order/doOrderCourseStatus')}",
                    data: {orderId:orderId},
                    dataType: 'json',
                    success: function(data) {
                        if (data.code == 200) {
                            layer.msg(data.msg, {icon: 1, time: 1000}, function() {
                                window.parent.location.reload();
                            });
                        } else {
                            layer.msg(data.msg, {icon: 2, time: 3000});
                        }
                    }
                });
            }
        );


    }
</script>
</body>
</html>